home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / apps / 102 / examples / exshift.c < prev    next >
C/C++ Source or Header  |  1987-01-25  |  2KB  |  36 lines

  1. /* p317 MW 'C' Oct'86 CJPurcell : use to show status of shift keys,etc.     */
  2. #include <osbind.h>            /* use               X               to exit */
  3. main() {
  4.       char key;
  5.       long shifts;
  6.       Cconws(" test shift keys; press X to exit back to calling program.\r\n");
  7.       while((key = Cconin()) != 'X') {
  8.              shifts = Getshift(-1);
  9.              if(key < 0x20) {
  10.                     Cconout('^');
  11.                     key += 40;
  12.              }
  13.              else
  14.                     Cconout(' ');
  15.              Cconout( key );
  16.  
  17.              if(shifts & 0x01)                   /* right shift down   */
  18.                     Cconws("[RShift]");
  19.              if(shifts & 0x02)                   /* left  shift down   */
  20.                     Cconws("[LShift]");
  21.              if(shifts & 0x04)                   /* Control key down   */
  22.                     Cconws("[Control]");
  23.              if(shifts & 0x08)                   /* Alternate key down */
  24.                     Cconws("[Alt_Key]");
  25.              if(shifts & 0x10)                   /* Caps lock on       */
  26.                     Cconws("[Caps_Lock]");
  27. /*           if(shifts & 0x20)              */   /* Right mouse button */
  28. /*                  Cconws("[RMouse]");     */   /* or  (CLR/HOME)     */
  29. /*           if(shifts & 0x40)              */   /* Right mouse button */
  30. /*                  Cconws("[LMouse]");     */   /* or   (INSERT)      */
  31. /* apparently, these last two functions are not now in TOSROM          */
  32.  
  33.        Cconws("\r\n");                           /* cr/lf at end of line */
  34.        }
  35. }
  36.